Passed
Pull Request — master (#116)
by Mathieu
02:02
created

main.ts ➔ bootstrap   A

Complexity

Conditions 1

Size

Total Lines 20
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 20
rs 9.45
c 0
b 0
f 0
cc 1
1
import {NestFactory} from '@nestjs/core';
2
import {SwaggerModule, DocumentBuilder} from '@nestjs/swagger';
3
import {ValidationPipe} from '@nestjs/common';
4
import * as helmet from 'helmet';
5
import {AppModule} from './app.module';
6
7
async function bootstrap() {
8
  const app = await NestFactory.create(AppModule);
9
  app.use(helmet());
10
  app.enableCors();
11
  app.setGlobalPrefix('api');
12
  app.useGlobalPipes(new ValidationPipe({transform: true}));
13
14
  const options = new DocumentBuilder()
15
    .setTitle('Permacoop')
16
    .setBasePath('api')
17
    .setDescription('Open-source ERP for cooperatives')
18
    .setVersion('1.0.0')
19
    .addBearerAuth('Authorization', 'header')
20
    .build();
21
22
  const document = SwaggerModule.createDocument(app, options);
23
  SwaggerModule.setup('api', app, document);
24
25
  await app.listen(3000, '0.0.0.0');
26
}
27
28
bootstrap();
29